# -*- coding: utf-8 -*-
__author__ = 'PP'
#54129119e479691d9c202e03
#单位换算规则
unitsetting = {
    '手机':{
        'RAM容量':{'MB':1,'GB':1024},
        '扩展容量':{'MB':1,'GB':1024},
        'CPU频率':{'MHz':1,'GHz':1000},
        '手机重量':{'g':1,'kg':1000},
    }
}

#属性转换参数
convertitems = {
    '手机':{
        '核心数':{'search':'.+','value':{'双核':2,'单核':1,'四核':4,'四核+1协核':5,'六核':6,'双四核':8,'真八核':8,'八核':8,'智能八核':8},'isFixed':True}, #中文转换
        'SIM卡类型':{'search':'.+','value':'(Micro SIM)|(Nano SIM)|(USIM)|(Mini UIM)|(Micro UIM)|(UIM)|(SIM)+','default':'SIM','isSelect':True}, #选择类型转换
        '网络类型':{'search':'.*','value':'(单卡)|(双卡)|(三卡)|(单模)|(双模)|(多模)|(双通)|(双3G)|(双4G)|(全网通)+','default':'单卡','isSelect':True}, #选择类型转换
        '电池容量':{'search':'(\d+).+','value':r"(\d+).+",'unit':r"\d+(.+)"},
        '主屏分辨率':{'search':'(\d+)x?×?(\d+).*','value':r"(\d+)x?×?(\d+)像素",'unit':r"\d+x?×?\d+(.{2})",'default':'像素','isMuti':True},
        'RAM容量':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*([a-zA-Z]*)",'default':'MB'},
        '扩展容量':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*([a-zA-Z]*)",'default':'GB'},
        '手机重量':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*(.*)",'default':'g'},
        '屏幕像素密度':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*([a-zA-Z]*)",'default':'ppi'},
        '后置摄像头像素':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*(.*)",'default':'万像素'},
        '窄边框':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*([a-zA-Z]*)",'default':'mm'},
        '主屏尺寸':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*(.*)",'default':'英寸'},
        '屏幕占比':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"%?",'default':'%'},
        'CPU频率':{'search':'(\d+\.?\d*).*','value':r"(\d+\.?\d*).*",'unit':r"\d+\.?\d*([a-zA-Z]*)",'default':'MHz'}
    }
}